#include <iostream>
#include <iomanip>
#include <conio.h>
#include "diskID.hpp"
#include "displayID.hpp"
#include "memoryID.hpp"
#include "netID.hpp"
#include "osID.hpp"
#include "processorID.hpp"
#include "soundID.hpp"
#include "videoID.hpp"

#define REVISION 23

void main()
{
	std::cout << "SysID rev. " << REVISION << "\n\n" << std::endl;

	OSID os;
	if( os.GetInfo() )
	{
		std::cout << "Operating System:\n";
		std::cout << "========================================";
		std::cout << os.Print() << std::endl;
	}

	MemoryID mem;
	if( mem.GetInfo() )
	{
		std::cout << "\n\nMemory:\n";
		std::cout << "========================================";
		std::cout << mem.Print() << std::endl;
	}

	ProcessorID proc;
	if( proc.GetInfo() )
	{
		std::cout << "\n\nProcessor:\n";
		std::cout << "========================================";
		std::cout << proc.Print() << std::endl;
		std::cout << proc.PrintData() << std::endl;
		std::cout << "========================================\n";
		std::cout << "Basic registers\n";
		std::cout << "========================================\n";
		for( int i=0; i<proc.m_Data.size(); ++i )
		{
			printf("0x%08x 0x%08x 0x%08x 0x%08x\n", proc.m_Data[i].eax, proc.m_Data[i].ebx, proc.m_Data[i].ecx, proc.m_Data[i].edx);
		}
		std::cout << "========================================\n";
		std::cout << "Extended registers\n";
		std::cout << "========================================\n";
		for( int i=0; i<proc.m_DataExtended.size(); ++i )
		{
			printf("0x%08x 0x%08x 0x%08x 0x%08x\n", proc.m_DataExtended[i].eax, proc.m_DataExtended[i].ebx, proc.m_DataExtended[i].ecx, proc.m_DataExtended[i].edx);
		}
	}

	/*DiskID disk;
	if( disk.GetInfo() )
	{
		std::cout << "Disks:\n";
		std::cout << "========================================";
		std::cout << disk.Print() << std::endl;
	}*/

	DisplayID disp;
	if( disp.GetInfo() )
	{
		std::cout << "\n\nDisplay:\n";
		std::cout << "========================================";
		std::cout << disp.Print() << std::endl;
	}

	VideoID vid;
	if( vid.GetInfo() )
	{
		std::cout << "\n\nVideocard:\n";
		std::cout << "========================================";
		std::cout << "\nMethod 1" << std::endl;
		for(std::size_t i=0; i<vid.m_VideoDevices.size(); ++i)
		{
			std::cout << "Videocard " << static_cast<unsigned int>(i) << std::endl;
			std::cout << "\tDescription:          " << vid.m_VideoDevices[i].m_Description << std::endl;
			std::cout << "\tManufacturer:         " << vid.m_VideoDevices[i].m_Manufacturer << std::endl;
			std::cout << "\tDriver version:       " << vid.m_VideoDevices[i].m_Driver.m_Version << std::endl;
		}
	}

	if( vid.GetInfo2() )
	{
		std::cout << "\n\nMethod 2" << std::endl;
		for(std::size_t i=0; i<vid.m_VideoDevices.size(); ++i)
		{
			std::cout << "Videocard " << static_cast<unsigned int>(i) << std::endl;
			std::cout << "\tHardware" << std::endl;
			std::cout << "\t\tDescription:          " << vid.m_VideoDevices[i].m_Description << std::endl;
			std::cout << "\t\tManufacturer:         " << vid.m_VideoDevices[i].m_Manufacturer << std::endl;
			if(vid.m_VideoDevices[i].m_Hardware.m_ChipType!="-")
				std::cout << "\t\tChip Type:            " << vid.m_VideoDevices[i].m_Hardware.m_ChipType << std::endl;
			if(vid.m_VideoDevices[i].m_Hardware.m_MemorySizeMB>0)
				std::cout << "\t\tMemory Size:          " << vid.m_VideoDevices[i].m_Hardware.m_MemorySizeMB << " MB" << std::endl;
			if(vid.m_VideoDevices[i].m_Hardware.m_MemoryType!="-")
				std::cout << "\t\tMemory Type:          " << vid.m_VideoDevices[i].m_Hardware.m_MemoryType << std::endl;
			if(vid.m_VideoDevices[i].m_Hardware.m_AGPRate!="-")
				std::cout << "\t\tTransfer Rate:        " << vid.m_VideoDevices[i].m_Hardware.m_AGPRate << std::endl;
			std::cout << "\tDriver" << std::endl;
			std::cout << "\t\tVersion:              " << vid.m_VideoDevices[i].m_Driver.m_Version << std::endl;
			std::cout << "\t\tDate:                 " << vid.m_VideoDevices[i].m_Driver.m_Date << std::endl;
			std::cout << "\t\tProvider:             " << vid.m_VideoDevices[i].m_Driver.m_Provider << std::endl;
		}//*/
	}
}


//------------------------------------------------------------------------
// Copyright (c) 2005 Rick Appleton
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
//    claim that you wrote the original software. If you use this software
//    in a product, an acknowledgment in the product documentation would
//    be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
//    be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
//    distribution.
//
// Rick Appleton
// www.daedalus-development.net
//------------------------------------------------------------------------
